﻿<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeFile="Default.aspx.cs" Inherits="_Default" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
    <style type="text/css">

    .style8
    {
        height: 466px;
        width: 900px;
    }
        .style9
        {
            font-family: Arvo, serif;
        }
    .style10
    {
        font-family: Arvo, serif;
        width: 12px;
    }
    .style11
    {
        font-family: Arvo, serif;
        width: 570px;
    }
    .style12
    {
        font-family: Arvo, serif;
        height: 201px;
    }
    </style>

     <style>
#dataDisplay
{
background-image: url('pics03.jpg');
background-color:Blue;
border:1px dotted #FFCC00;
display:table;
width:230px;
height:220px;
padding:2px;
font-size:15px;
color: #FFFFFF;
}
</style>

<script type="text/javascript" src="JQuery.js"></script>

<script language="JavaScript">

    setInterval("test();", 2000);

    function test() {
        var divToBeWorkedOn = '#dataDisplay';
        var webMethod = 'WebService.asmx/displayStock';
        var parameters = "{}";

        $.ajax({
            type: "POST",
            url: webMethod,
            data: parameters,
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (response) {
                var stocks = response.d;
                $(divToBeWorkedOn).empty();
                //$(divToBeWorkedOn).append('<br>Stock Name : Price</br>');
                $.each(stocks, function (index, stock) {
                    $(divToBeWorkedOn).append('<br>' + stock.Name + ': ' + stock.Price + '  <asp:Image ID="Image1" runat="server" ImageUrl="~/Images/clip_image001.gif" /> </br>');
                });
            },
            error: function (e) {
                $(divToBeWorkedOn).html("Unavailable");
            }
        });
    }
</script>

</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <div id="splash">
        <table align="center" class="style8" style="margin-left: 0px;">
            <tr>
                <td class="style12" colspan="3">
                    <asp:Image ID="Image2" runat="server" Height="164px" 
                        ImageUrl="~/Images/pics01.jpg" Width="902px" />
                </td>
            </tr>
            <tr>
                <td class="style9" colspan="3">
                    <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true" 
                        EnablePartialRendering="true" />
                </td>
            </tr>
            <tr>
                <td class="style10">
                <a href="Registration.aspx">
                    <asp:Image ID="Image3" runat="server" Height="220px" 
                        ImageUrl="~/Images/pics02.jpg" postUrl="Registration.aspx" 
                        style="margin-right: 67px" Width="260px" DescriptionUrl="~/Registration.aspx" />
                        </a>
                </td>
                <td class="style11">
                <a href="BuySell.aspx">
                    <div id="dataDisplay"></div>
                    </a>
                </td>
                <td class="style9">
                <a href="Stock History.aspx">
                    <asp:Image ID="Image5" runat="server" Height="220px" 
                        ImageUrl="~/Images/pics04.jpg" Width="260px" />
                        </a>
                </td>
            </tr>
        </table>
    </div>
    </asp:Content>
